<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport" />
<title>网络中国节投票列表</title>
<meta content="" name="keywords" />
<meta content="" name="description" />
<meta content="" name="author" />
<link href="__css__style.css" type="text/css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="__font__iconfont.css">
<script type="text/javascript" src="__js__jquery-1.9.1.min.js"></script>
</head>

<body>
	<assign name="netid" value="$Think.get.netid"/>
    <p class="tishi">您已投票成功</p>
	<div class="w">
        <div class="banner2">
            <img src="__img__list-banner.jpg">
        </div>
        <assign name="fstvid" value="$Think.get.fstvid"/> <!--用get获取当前fstvid地址栏参数 -->
        <div class="tabnav">
            <div class="ulnav clearfix">
                <ul>
                  <foreach name="netlst" item="vo">
                     <li <if condition="$vo['netid'] eq $netid">class="hover"<elseif condition="($netid eq '') and ($key eq 0)"/>class="hover"</if>>
                          <!-- <a href="{:U('listvote',array('fstvid'=>$fstvid,'netid'=>$vo['netid']))}">{$vo.netname}</a> -->
                          <a href="javascript:void(0)" class="status" fstvid="{$fstvid}" netid="{$vo.netid}">{$vo.netname}</a>
                     </li> 
                  </foreach>
                </ul>
            </div>
        </div>
        <div class="content-list-box" id="data">

        </div>
	</div>
	<!--footer-->
    <div class="footer3 clearfix">
        <a href="{:U('index')}"><i class="shortmovie  shortmovie-shouye1 foot-icon"></i><br/>首页</a>
        <a href="#" class="current tankuangbtn"><i class="shortmovie  shortmovie-xingguang foot-icon2"></i><br/>投票</a>
    </div>
<!--foot over-->
<!--ready_box over-->
<script type="text/javascript">
    $(document).ready(function($) {
        $(".toupiao-btn").click(function(event) {
            $(".tishi").fadeIn();
        });
        var timesRun = 0;
        var interval = setInterval(function(){
        timesRun += 1;
        if(timesRun === 60){
        clearInterval(interval);
        }
        $(".tishi").fadeOut()
        }, 2000);

        $(".footer3 a").click(function(event) {
            $(this).addClass('current').siblings('.footer3 a').removeClass('current')
        });

        
    });
</script>
<script type="text/javascript">
    $(function(){
        var lilengt = 0;
        var obj = $(".tabnav");

        $(".mvot_list:first").show();
        obj.find("li").each(function(index, element) {
            var t = $(this);
            lilengt += eval(t.width());
            t.click(function(){
                $(this).addClass("hover").siblings().removeClass("hover");
                $(".mvot_list:eq("+index+")").show().siblings().hide();
            })
        }); 

        $(".tabnav .ulnav").css({"width":lilengt+30+"px"});

        // var len=$(".tabnav li").length;
        // if (len==1) {
        //     $(".tabnav li").css({
        //         "width": '100%'
        //     });
        // }
        // 
        
        var len=$(".tabnav li").length;
        if (len==1) {
            $(".tabnav li").css({
                "width": '100%'
            });
            $(".tabnav .ulnav").css({"width":"100%"});
        };

        var len=$(".tabnav li").length;
        if (len==2) {
            $(".tabnav li").css({
                "width": '50%'
            });
            $(".tabnav .ulnav").css({"width":"100%"});
        };

        var len=$(".tabnav li").length;
        if (len==3) {
            $(".tabnav li").css({
                "width": '33.3%'
            });
            $(".tabnav .ulnav").css({"width":"100%"});
        };

        var len=$(".tabnav li").length;
        if (len==4) {
            $(".tabnav li").css({
                "width": '25%'
            });
            $(".tabnav .ulnav").css({"width":"100%"});
        }

    function toupiao(){
        $(".content-list-box").each(function(index,element){
            var t = $(this);
            t.find(".toupiao .toupiao-btn").click(function(){
                var t1 = $(this);
                var articid =  $(this).attr("actid");
                var numval  =  t1.parent().find("b.num").html();
                if(numval==''){
                    numval = 0;
                }
                $.ajax({
                    type: 'POST',
                    url: '__URL__/addVote',
                    dataType:'JSON',
                    data: {articid:articid,num:numval,rand:Math.random()},
                    success: function (data) {
                        //  alert(JSON.stringify(data.votes));
                        if(data==1){
                            $(".tishi").show();
                            $(".tishi").html("不能投票超过3次,明天再来吧");
                        }else if (data==5){ 
                            $(".tishi").show();
                            $(".tishi").html("我们的投票结束啦,谢谢大家");
                        }else{
                            $(".tishi").show();
                            $(".tishi").html("您已经投票成功");
                            t1.parent().find("b.num").html(data.votes);
                        }
                    }
                });
            });
        })
    }


        $("a.status").each(function(index,element){
            var t = $(this);
            t.click(function(){
                var fstvid =  $(this).attr("fstvid");
                var netid  =  $(this).attr("netid");
                showdata(fstvid,netid);
            })
        })
        var obj = $("a.status:first()");
        var fstvid =  obj.attr("fstvid");
        var netid  =  obj.attr("netid");
        showdata(fstvid,netid);

        function showdata(fstvid,netid){
            $.ajax({
                type: 'POST',
                url: '__URL__/listajax',
                dataType:'html',
                data: {fstvid:fstvid,netid:netid,rand:Math.random()},
                success: function (data) {
                    //alert(data);
                    $("#data").html(data);
                    toupiao();
                }
            });
        }



    })


</script>
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?996ff5636cc816a4703cb2156ef1796b";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>
</body>
</html>
